-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Core} Top-level tab completion performance improvements #32616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
{Core} Top-level tab completion performance improvements #32616
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
| import os | ||
| import sys | ||
|
|
||
| if sys.platform == 'win32': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emulating skips of incumbent tests, I believe it may be a CI/CD limitation.
c3e4eb1 to
d1a0f27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a performance optimization for top-level tab completion (i.e., az [TAB]) by avoiding the loading of all command modules. Instead of loading modules to build the full command table, it creates lightweight stub commands using command names from the command index, reducing completion time from over 5 seconds to under 1 second.
Changes:
- Added a new optimization path for top-level completion that creates stub commands without loading modules
- Introduced
TOP_LEVEL_COMPLETION_MARKERconstant to signal the optimization path - Added
_get_top_level_completion_commands()method to retrieve command names from the index - Added
_create_stub_commands_for_completion()method to create lightweight command stubs - Added test coverage for the new top-level completion functionality
- Added VS Code debug configuration for testing tab completion
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/azure-cli-core/azure/cli/core/init.py | Core implementation of the tab completion optimization, including stub command creation and command index query logic |
| src/azure-cli-core/azure/cli/core/tests/test_argcomplete.py | Added test case to verify top-level completion returns expected command names |
| .vscode/launch.json | Added debug configuration for testing tab completion in external terminal |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
Description
This PR aims to improve the performance of top-level tab-completion, (i.e.,
az [TAB]).Local testing has shown significant improvements to performance, going from over 5 seconds to under 1 second (Powershell), and from over 1 minute to a couple of seconds on WSL Bash.
Testing conditions:
Testing Guide
Please ensure your terminal is set up for tab-completion.
Test changes with
az [TAB].History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.